package com.ouc.openplatform.ouc.authManage.service.impl;
import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ouc.openplatform.ouc.authManage.dao.NJ_AuthorityInfoDAO;
import com.ouc.openplatform.ouc.authManage.model.NJ_AuthorityInfo;
import com.ouc.openplatform.ouc.authManage.service.NJ_AuthorityInfoService;
import com.ouc.openplatform.pojo.EUDataGridResult;
public class NJ_AuthorityInfoServiceImpl implements NJ_AuthorityInfoService{
	private NJ_AuthorityInfoDAO nj_authorityInfoDao;
	
	public NJ_AuthorityInfoDAO getNj_authorityInfoDao() {
		return nj_authorityInfoDao;
	}

	public void setNj_authorityInfoDao(NJ_AuthorityInfoDAO nj_authorityInfoDao) {
		this.nj_authorityInfoDao = nj_authorityInfoDao;
	}

	
	//1.增加权限信息-----sxl
	@Override
	public int saveAuthorityInfo(NJ_AuthorityInfo authorityinfo){
		return nj_authorityInfoDao.insert(authorityinfo);
	}
	//2.删除权限信息-----sxl
	@Override
	public int deleteAuthorityInfo(int id){
		return nj_authorityInfoDao.deleteByPrimaryKey(id);
	}
	//3.修改权限信息-----sxl
	@Override
	public int updateAuthorityInfo(NJ_AuthorityInfo authorityinfo){
		return nj_authorityInfoDao.updateByPrimaryKeySelective(authorityinfo);
	}
	//4.查询权限信息-----sxl
	@Override
	public EUDataGridResult getAllAuthorityInfo(NJ_AuthorityInfo authorityinfo, int page, int rows) {
		//分页处理
		PageHelper.startPage(page, rows);
		List<NJ_AuthorityInfo> select = nj_authorityInfoDao.select(authorityinfo);
		//创建一个返回值对象
		EUDataGridResult result = new EUDataGridResult();
		result.setRows(select);
		//取记录总条数
		PageInfo<NJ_AuthorityInfo> pageInfo = new PageInfo<NJ_AuthorityInfo>(select);
		result.setTotal(pageInfo.getTotal());
		return result;
	}
	@Override
	public List<NJ_AuthorityInfo>getAuthorityInfo(NJ_AuthorityInfo authorityinfo){
		return nj_authorityInfoDao.select(authorityinfo);
	}

	@Override
	public List<NJ_AuthorityInfo> getAuthorityInfoByParentid(int parentid) {
		return nj_authorityInfoDao.getAuthorityInfoByParentid(parentid);
	}

	
	
}
